package cnpm02.j2ee.group3.model;

import static javax.persistence.CascadeType.MERGE;
import static javax.persistence.CascadeType.PERSIST;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.validator.NotNull;

@Entity
@Table(name = "NATIONALITY_TRANSLATION", uniqueConstraints = @UniqueConstraint(columnNames = {
                "NationalityId", "Language"}))
@AttributeOverride(name = "id", column = @Column(name = "NationalityTranslationId"))
public class NationalityTranslation extends AbstractTranslationEntity {
	private static final long serialVersionUID = 7369567281357755358L;

	@ManyToOne(cascade = {PERSIST, MERGE})
	@JoinColumn(name = "NationalityId", nullable = false)
	@NotNull
	private Nationality nationality;

	public NationalityTranslation() {
		super();
	}

	public NationalityTranslation(Nationality _nationality, SupportedLanguage _lang,
			String _translation) {
		super(_lang, _translation);
		setNationality(_nationality);
	}

	public void setNationality(Nationality nationality) {
		this.nationality = nationality;
	}

	public Nationality getNationality() {
		return nationality;
	}

}
